<html>
<head><meta charset="utf-8"><title>Help testing -Zbuild-std with sanitizer=memory · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Help.20testing.20-Zbuild-std.20with.20sanitizer.3Dmemory.html">Help testing -Zbuild-std with sanitizer=memory</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="217764932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Help%20testing%20-Zbuild-std%20with%20sanitizer%3Dmemory/near/217764932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> G2P <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Help.20testing.20-Zbuild-std.20with.20sanitizer.3Dmemory.html#217764932">(Nov 24 2020 at 15:01)</a>:</h4>
<p>Hello!<br>
I went down a rabbit hole which is traced here:<br>
<a href="https://github.com/rust-fuzz/cargo-fuzz/issues/243">https://github.com/rust-fuzz/cargo-fuzz/issues/243</a><br>
As far as I can tell, stdarch has a broken function prototype (in avx512f, which is not relevant to my computer but needs to build anyway).  Compiling the core library with msan makes any such broken prototype show up.<br>
I'd like to boil it down to a test.<br>
I've written a test that runs cargo -Zbuild-std=core, with some specific RUSTFLAGS. I put it in run-make-fulldeps, which seems to work (I'm waiting for the second run to finish and my machine is slow).<br>
Is this kind of test, that runs cargo from stage1, acceptable? I found very few such tests, but I don't think there's a simpler way to check for the entire class of problems.</p>



<a name="217765188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Help%20testing%20-Zbuild-std%20with%20sanitizer%3Dmemory/near/217765188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Help.20testing.20-Zbuild-std.20with.20sanitizer.3Dmemory.html#217765188">(Nov 24 2020 at 15:02)</a>:</h4>
<p>you just need to check whether it compiles, not whether it runs, right? could you add a test in stdarch itself that sets RUSTFLGAS? then you don't need to mess with bootstrapping</p>



<a name="217765504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Help%20testing%20-Zbuild-std%20with%20sanitizer%3Dmemory/near/217765504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> G2P <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Help.20testing.20-Zbuild-std.20with.20sanitizer.3Dmemory.html#217765504">(Nov 24 2020 at 15:05)</a>:</h4>
<p>I just need it to compile, yes<br>
I'm not sure I can test in stdarch directly, though, I've only been able to trigger the error through rustc and llvm</p>



<a name="217765725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Help%20testing%20-Zbuild-std%20with%20sanitizer%3Dmemory/near/217765725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> G2P <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Help.20testing.20-Zbuild-std.20with.20sanitizer.3Dmemory.html#217765725">(Nov 24 2020 at 15:06)</a>:</h4>
<p>It appears in one of two forms:</p>
<div class="codehilite"><pre><span></span><code>LLVM ERROR: Cannot select: 0x7f96e9336bf0: v64i8 = X86ISD::PALIGNR 0x7f96e93296b0, 0x7f96e9381fe8, TargetConstant:i8&lt;8&gt;
  0x7f96e93296b0: v64i8,ch = load&lt;(load 64 from %ir.2245)&gt; 0x7f96f547cba8, 0x7f96e9337270, undef:i64
    0x7f96e9337270: i64 = xor 0x7f96e93298b8, 0x7f96e9279c58
      0x7f96e93298b8: i64,ch = CopyFromReg 0x7f96f547cba8, Register:i64 %1119
        0x7f96e93424a0: i64 = Register %1119
      0x7f96e9279c58: i64 = AssertZext 0x7f96e9272c00, ValueType:ch:i47
        0x7f96e9272c00: i64,ch = CopyFromReg 0x7f96f547cba8, Register:i64 %6
          0x7f96e927fad0: i64 = Register %6
    0x7f96e931fb58: i64 = undef
  0x7f96e9381fe8: v64i8 = bitcast 0x7f96e9344420
    0x7f96e9344420: v16i32,ch = CopyFromReg 0x7f96f547cba8, Register:v16i32 %782
   Compiling rustc-std-workspace-core v1.99.0 (/home/g2p/src/github.com/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/rustc-std-workspace-core)
      0x7f96e927a410: v16i32 = Register %782
  0x7f96e93820b8: i8 = TargetConstant&lt;8&gt;
In function: _ZN4core9core_arch3x867avx512f17_mm512_shuffle_ps17h2adad9c5dc64a280E
</code></pre></div>
<div class="codehilite"><pre><span></span><code>PHI node operands are not the same type as the result!
  %_msphi_s = phi i32 [ %42, %38 ], [ %35, %31 ], [ %28, %24 ], [ %21, %17 ], [ %14, %10 ]
in function _ZN4core9core_arch3x867avx512f19_mm_cvt_roundss_u3217h42028e7a281c0c10E
LLVM ERROR: Broken function found, compilation aborted!
</code></pre></div>



<a name="217766570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Help%20testing%20-Zbuild-std%20with%20sanitizer%3Dmemory/near/217766570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> G2P <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Help.20testing.20-Zbuild-std.20with.20sanitizer.3Dmemory.html#217766570">(Nov 24 2020 at 15:13)</a>:</h4>
<p>The test seems to work and highlight the regression well, I'll send a PR and link it here</p>



<a name="217768572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Help%20testing%20-Zbuild-std%20with%20sanitizer%3Dmemory/near/217768572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> G2P <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Help.20testing.20-Zbuild-std.20with.20sanitizer.3Dmemory.html#217768572">(Nov 24 2020 at 15:27)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/79382">https://github.com/rust-lang/rust/pull/79382</a></p>



<a name="217768668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Help%20testing%20-Zbuild-std%20with%20sanitizer%3Dmemory/near/217768668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> G2P <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Help.20testing.20-Zbuild-std.20with.20sanitizer.3Dmemory.html#217768668">(Nov 24 2020 at 15:28)</a>:</h4>
<p>Fixing stdarch is an open question though, I'll put an issue there as well</p>



<a name="217771211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Help%20testing%20-Zbuild-std%20with%20sanitizer%3Dmemory/near/217771211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> G2P <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Help.20testing.20-Zbuild-std.20with.20sanitizer.3Dmemory.html#217771211">(Nov 24 2020 at 15:45)</a>:</h4>
<p><a href="https://github.com/rust-lang/stdarch/issues/957">https://github.com/rust-lang/stdarch/issues/957</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>